#include<cstdio>
using namespace std;
int n,l,r,ans;
int main()
{
	freopen("candy.in","r",stdin);
	freopen("candy.out","w",stdout);
	scanf("%d%d%d",&n,&l,&r);
	if(l/n!=r/n)
	ans=n-1;
	else
	ans=r%n;
	printf("%d",ans);
	return 0;
}
